<?php
	require_once 'View/LoginView.php';
	require_once 'Model/LoginHandler.php';
	require_once 'Controller/LoginController.php';
	require_once 'Controller/FileUploadController.php';
	require_once 'Controller/RegisterController.php';
	
	
	require_once 'View/PageCompositionView.php';
	require_once 'common/DBConnection.php';
	require_once 'Model/User.php';
	class MasterController{
		
		private $loginView;
		private $loginHandler;
		private $loginController;
		private $fileUploadController;
		private $pageCompositionView;
		private $loginPage;
		private $registerController;
		private $registerPage;
		private $dbconnection = NULL;
		
		private $Usertablename = "Users";
		
		
		public function __construct(){
			
			$this->dbconnection = new DBConnection();
			$this->pageCompositionView = new PageCompositionView();
		}
		
		public function DoControl(){
			
			$this->dbconnection->Connect();
			
			$this->loginView = new LoginView();
			$this->loginHandler = new LoginHandler($this->dbconnection);
			$this->loginController = new LoginController($this->loginView, $this->loginHandler);
			$this->registerController = new RegisterController($this->dbconnection, $this->loginHandler);			        
		    $this->fileUploadController = new FileUploadController($this->loginHandler);
			
			$this->loginPage = $this->loginController->DoControl();
		    $this->fileUploadPage = $this->fileUploadController->DoControl();
			$this->registerPage = $this->registerController->DoControl();
			$page = $this->pageCompositionView->RenderWebSite($this->loginPage, $this->fileUploadPage, $this->registerPage);
			
			$this->dbconnection->Close();
			return $page;
		}
	}
